Data detection

ABSTRACT

A method for detecting data in a sequence of characters or text using both a statistical engine and a pattern engine. The statistical engine is trained to recognize certain types of data and the pattern engine is programmed to recognize the grammatical pattern of certain types of data. The statistical engine may scan the sequence of characters to output first data, and the pattern engine may break down the first data into subsets of data. Alternatively, the statistical engine may output items that have a predetermined probability or greater of being a certain type of data and the pattern engine may then detect the data from the output items and/or remove incorrect information from the output items.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to methods, systems and articles of manufacture for detecting useful data from blocks of text or sequences of characters.

2. Description of the Background Art

Various methods of detecting data in text are well-known. For example, such methods can be used to analyse bodies of text, such as e-mails or other data received by or input to a computer, to extract information such as e-mail addresses, telephone and fax numbers, physical addresses, IP addresses, days, dates, times, names, places and so forth. In one implementation, a so-called data detector routinely analyses incoming e-mails to detect such information. The detected information can then be extracted to update the user's address book or other records.

Known methods of detecting data include pattern detection methods. Such a method may analyse a body of text to find patterns in the grammar of the text that match the typical grammar pattern of a data type that the method seeks to identify. In general, in such a method, a grammatical function is assigned to each block, such as a word, in the text. The method then compares sequences of grammatical functions in the text to predetermined patterns of functions, which typically make up the types of data to be detected. If a match is found, the method outputs the blocks corresponding to the sequence of grammatical functions as the detected data.

As an example, such a method may assign a single digit from 0 to 9 followed by a space with the function DIGIT; two or more digits with the function NUMBER; two or more letters adjacent with the function WORD; and so forth. Once the functions have been assigned, patterns can be detected. For example, an associated name and address may have the pattern of neighbouring functions: NAME, COMPANY, STREET, POSTAL_CODE, STATE, where some of the functions may be optional.

Such pattern detection methods have generally proven highly effective. However, there remain difficulties in correctly picking out names of organisations and some addresses from bodies of text, as well as in matching all names to an address.

Known methods of detecting data also include statistical learning methods. In general, in such a method a computer program is trained to locate and classify atomic elements in text into predefined categories based on a large corpus of manually annotated training data. Typically, the training data consists of several hundred pages of text, carefully annotated to identify desired categories of data. Thus, in the corpus, each person name, organization name, address, telephone number, e-mail address, etc must be tagged. The program then scans the annotated text and learns how to identify each category of data. Following this training stage, the program may process different bodies of unannotated text and pick out data of the desired categories.

Such methods are heavily reliant on both the text chosen for the training corpus and the accuracy with which it is annotated, not to mention the algorithm by which the program learns. In addition, such programs output as a result all the data matching a particular category. For example, although such programs are particularly successful in identifying complete addresses, they cannot then output the individual elements of a detected address. Accordingly, they are unable to output the street line of an address as a distinct component going to make up the whole address.

SUMMARY OF THE INVENTION

The present invention provides a method, an article of manufacture and a system for detecting data in a sequence of characters or text using both a statistical engine and a pattern engine. The statistical engine is trained to recognize certain types of data and the pattern engine is programmed to recognize the grammatical pattern of certain types of data.

The statistical engine may scan the sequence of characters to output first data, and the pattern engine may break down the first data into subsets of data. Alternatively, the statistical engine may output items that have a predetermined probability or greater of being a certain type of data and the pattern engine may then detect the data from the output items and/or remove incorrect information from the output items.

In another variation, the statistical engine scans the text and outputs a series of tokens with respective token types, which are parsed by a parser of the pattern engine. Alternatively, the pattern engine may further comprise a lexer, which also scans the data and outputs a series of tokens with respective token types. The tokens from the statistical engine and the pattern engine are parsed by the parser of the pattern engine. As a further alternative, the statistical engine outputs some tokens and forwards them together with the remaining unchanged text to the lexer. The lexer converts the remaining text into tokens and the resultant stream of tokens, including tokens from both the statistical engine and the pattern engine, are parsed.

The present invention makes use of the advantageous aspects of statistical engines and pattern engines respectively, and minimizes their drawbacks. In particular, the present invention makes it possible to more quickly and accurately detect combinations of the various elements of contact details, such as names, physical addresses (including eastern addresses, such as Chinese and Japanese addresses), e-mail addresses, phone numbers, fax numbers and so forth. The various elements of the names and addresses are decomposed so they are particularly suited for future use by a user.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the present invention will now be described by way of example only with reference to the accompanying drawings in which:

FIG. 1 is a schematic illustration of a combination engine according to an embodiment of the present invention;

FIG. 2 is a schematic illustration of a pattern engine according to an embodiment of the present invention;

FIG. 3 shows a decision tree of a parser according to an embodiment of the present invention;

FIG. 4 is a schematic illustration of a text decomposition process according to an embodiment of the present invention;

FIG. 5 is a schematic illustration of a text decomposition process according to an embodiment of the present invention;

FIG. 6 is a schematic illustration of a text decomposition process according to an embodiment of the present invention;

FIG. 7 is a schematic illustration of a combination engine according to an embodiment of the present invention;

FIG. 8 is a schematic illustration of a combination engine according to an embodiment of the present invention;

FIG. 9 is a schematic illustration of a combination engine according to an embodiment of the present invention;

FIG. 10 is a schematic illustration of a combination engine according to an embodiment of the present invention; and

FIG. 11 is a schematic illustration of a computer system in which a combination engine according to an embodiment of the present invention may be realised.

DETAILED DESCRIPTION

FIG. 1 schematically illustrates a combination engine 1 of the present invention, which can be embodied in a processor. The combination engine 1 comprises a statistical engine 10 in series with a pattern engine 20.

The statistical engine 10 is an adaptation of a known statistical engine of any suitable type. The statistical engine has been trained using a previously annotated corpus in a desired language and including text of the types of data intended to be detected. After the text of the corpus has been chosen and annotated, one of a large variety of different statistical machine learning techniques is used to teach the statistical engine 10 to extract desired types of data from input text, together with a tag describing the output data, based on the annotated corpus. In general, the annotations in the training corpus will match the tags output with the data.

There are many well-known techniques for teaching a statistical model to map between input text and output data. One example is the maximum entropy method, but any other suitable technique may also be used.

In the present embodiment, once the statistical engine 10 has been taught, it receives text input in the form of a sequence of characters. There is no limitation on what characters can make up the text. It is important to recognise that at this stage no further teaching is required, although the engine 10 may continue to learn in alternative embodiments of the invention. As such, the statistical engine 10 may be a pre-taught engine imported into the combination engine 1 without the facility for further learning.

The statistical engine 10 parses the input characters and calculates a likelihood that blocks of text within the sequence of characters make up data of a type that is being sought. For example, the statistical engine 10 will calculate whether a block of text forms a name, an address, or the like. If the calculated likelihood is greater than a predetermined threshold, the statistical engine 10 outputs the block to the pattern engine 20 together with a tag for the block.

For example, assume that a statistical engine has been trained to detect quantities, person names, organisation names and addresses, and receives as the text input the following e-mail:

-   “Jon, I am considering buying 300 shares in Acme Inc. Before I make     the purchase, please contact Wilson Nagai, Graebel Broking Services     Worldwide, 16346 E. Airport Circle, Aurora, Colo. 80011, USA to get     his advice”. -   The statistical engine will output <tags> and blocks of text, having     determined that the probability of accurate output is greater than a     predetermined threshold of, for example, 90%, as follows: -   <person name>Jon -   <quantity>300 shares -   <organisation name>Acme Inc. -   <person name>Wilson Nagai -   <address>Graebel Broking Services Worldwide, 16346 E. Airport     Circle, Aurora, Colo. 80011, USA

FIG. 2 shows a schematic representation of the pattern engine 20. In the present invention, the pattern engine 20 determines the grammatical structure of the text to pick out the predetermined data. More specifically, the pattern engine 20 uses the statistical modeling of data to determine which grammatical patterns relate to which types of information. For example, a statistical model may show that a time always has the pattern of a meridian (am or pm) followed by two digits. Similarly, it may show that a bug identification always has the grammatical pattern of two letters followed by four numbers. In this example, the pattern engine would be programmed so that if it detects a meridian followed by two digits, it will output them as a time, and if it detects two initials followed by four digits, it will output them as a bug identification.

The pattern engine 20 comprises a lexical analyser or lexer 22 and a parser 24. The lexer 22 receives as its input a sequence of characters. The lexer 22 stores a vocabulary that allows it to resolve the sequence of characters into a sequence of tokens. Each token comprises a lexeme (analogous to a word) and a token type (which describes its class or function).

As mentioned above, in the present example, the format of a time to be detected is that it is always one of AM or PM followed by two digits, whereas the format of a bug identification code to be detected is always two letters followed by three digits. Accordingly, the lexer 22 may be provided with the vocabulary:

INITIALS: = [A-Z]{2} (INITIALS is any two letters together) MERIDIAN: = (A|P)M (MERIDIAN is the letter A or the letter P, followed by the letter M) DIGIT: = [0-9] (DIGIT is any character from 0 to 9) whereas the parser 24 may be provided with the grammar:

BUG_ID:= INITIALS DIGIT{3} (INITIALS token followed by 3 DIGIT tokens) TIME: = MERIDIAN DIGIT{2} (MERIDIAN token followed by 2 DIGIT tokens)

In more detail, the lexer will output a sequence of a letter from A to Z followed by another letter from A to Z as a token having a lexeme of the two letters and having the token type INITIALS. It will also output the letters AM and PM as a token having the token type MERIDIAN. The processing of a sequence of characters to output tokens and respective token types, and the processing of tokens and token types to output sought data can be performed using decision trees.

As another example, a parser may be provided with the grammar

-   ADDRESS: =name? company? street     In this notation, ‘?’ indicates that the preceding token need not be     present. Accordingly, to detect an address, it is only necessary for     a street to be present, a name and/or a company in front of the     street being optional. Thus, an epsilon reduction is required for     both the name and company. Using the token types a, b and c, the     grammar can be rewritten as -   a: =name|ε -   b: =company|ε -   c: =street -   ADDRESS: =a b c     where ε signifies ‘nothing’.

FIG. 3 shows a corresponding decision tree for the parser, which determines that an address has been detected when it reaches state F. In this case, the fact that the “name” token is optional is handled by the path from the starting state S to state 1, the reduction for state 1 and the epsilon reduction for starting state S. Similarly, the fact that the “company” token is optional is handled by the path from state 2 to state 5, the reduction for state 5 and the epsilon reduction for state 2.

As a further example, assume that a pattern engine has been programmed to detect quantities, person names, organisation names and addresses, and also receives as the text input the following e-mail:

-   “Jon, I am considering buying 300 shares in Acme Inc. Before I make     the purchase, please contact Wilson Nagai, Graebel Broking Services     Worldwide, 16346 E. Airport Circle, Aurora, Colo. 80011, USA to get     his advice”.     The pattern engine may output the <tags> and blocks of text, having     determined that blocks of text match the pre-programmed pattern: -   <person name>Jon -   <number>300 -   <organisation name>Acme Inc. -   <person name>Wilson Nagai -   <address>(<<company name>>Broking Services     Worldwide<<street>>16346 E. Airport     Circle<<town>>Aurora<<state>>CO<<postal code>>80011<<country>>USA)

Here, it can be seen that the pattern engine, unlike the statistical engine of the foregoing example, is unable to detect that the number 300 relates to a quantity of something, as opposed to any other number. Similarly, the pattern engine has incorrectly extracted the address, referring to “Broking Services Worldwide” instead of “Graebel Broking Services Worldwide”. This could be because the lexer has output a token having the lexeme “Graebel” with an incorrect token type, or the grammar of the parser only recognises company names of three words or less.

Thus, a fundamental difference between a statistical engine and a pattern engine is that a statistical engine has been trained, using an extensive training corpus, to determine the likelihood that blocks of characters within a sequence of characters make up data of the type being sought, whereas a pattern engine has algorithms for comparing grammatical patterns within the sequence of characters with preset patterns in a vocabulary and grammar predetermined by the programmer. In general, either these preset patterns are matched or not.

In the present specification, the terms “pattern engine”, “pattern detection method”, “statistical engine” and “statistical detection method” should be construed accordingly.

Consequently, the output of a statistical engine can be changed by varying a probability threshold, whereas the output of a pattern engine can only be changed by varying the pre-programmed grammatical patterns—that is, by changing the vocabulary and the grammar of the pattern engine. In general, a statistical engine recognises certain types of data, particularly names and some form of physical address, more accurately than a pattern engine and is easier to adapt, by changing the probability threshold and by using different training corpuses. Processing is also generally faster. However, it outputs the detected data in a less useful way.

In this embodiment of the present invention, a sequence of characters is input to the combination engine 1 and is first processed by the statistical engine 10. The statistical engine outputs a series of blocks of text, each representing detected data, together with a tag for each block, indicating the type of data that has been detected, as shown in FIG. 4.

The pattern engine 20 receives the blocks and associated tags from the statistical engine 10 and processes each one in turn. Note that large amounts of spurious or useless data will have been removed by the statistical engine 10, thereby considerably reducing the amount of processing required by the pattern engine 20. In the present embodiment, it is accepted that the statistical engine 10 has output correct and complete data and the function of the pattern engine 20 is to decompose that data if possible.

Accordingly, the pattern engine 20 receives and processes each block of text separately. For example, assume that the statistical engine 10 outputs

-   <person name>Jon -   gap -   <quantity>300 -   gap -   <organisation name>Acme Inc. -   gap -   <person name>Wilson Nagai -   <address>Graebel Broking Services Worldwide, 16346 E. Airport     Circle, Aurora, Colo. 80011, USA

The pattern engine 20 processes each of the above blocks individually, but is adapted to recognise that all lexemes in a block of text are useful and cannot be discarded. In the event of conflict between the results of the statistical engine 10 and the pattern engine 20, the results of the statistical engine prevail.

In this example, the pattern engine 20 is not able to decompose the block of text “Jon” and accordingly will simply output “Jon” as a person name, in accordance with the determination made by the statistical engine 10. Similarly, the pattern engine 20 is unable to determine the data type of the number “300” and will therefore output the number “300” as a quantity in accordance with the tag assigned by the statistical engine 10. Similar considerations apply in respect of the person name “Wilson Nagai”.

Further, the pattern engine 20 will process the sequence of characters “Graebel Broking Services Worldwide, 16346 E. Airport Circle, Aurora, Colo. 80011, USA” and output it as an address, in line with the output of the statistical engine, but further tagged as <Company Name>Graebel Broking Services Worldwide; <Street>16346 E. Airport Circle; <Town>Aurora; <State>CO; <Postal Code>80011; <Country> USA.

Note here that the grammar of the parser 24 is forced to append the previously redundant lexeme “Graebel” to the company name in order to avoid conflict with the statistical engine. Thus, the statistical engine 10 can be termed the master engine and the pattern engine 20 can be termed the subordinate engine.

One way in which the grammar of the parser 24 may be forced to properly append the previously redundant lexeme is to provide a score for all patterns recognised by the parser 24. Matched “fuzzy” patterns can be provided with lower scores than less “fuzzy” (or harder) patterns to reflect the fact that the “harder” patterns are more likely to relate to types of data that are being sought. The parser 24 may lower the minimum acceptable score for a matched pattern until all the names/lexemes from the statistical engine have been matched. In this way, correct pattern matches are more likely to be output but the parser will still be forced to use all the information output from the statistical engine 10.

The decomposition of the address field in this way has the advantage that the address data is more useful. For example, where the tags match fields provided in a contacts address book, the address can be automatically added to a contacts address book with the appropriate parts of the address being entered into the fields provided by the address book. Moreover, where an address is provided on one line in a body of text, the decomposition of the address allows it to be automatically used in the proper format on a later occasion, for example when using the address in a letter or to prepare a label for an envelope.

In a second embodiment of the present invention, processing is again carried out first by a statistical engine 10 and then by a pattern engine 20. However, in this case, the threshold of the statistical engine 10 is set to be low. This means that the statistical engine will output all data that has even a low probability of matching the type of data being sought—e-mail addresses, telephone and fax numbers, physical addresses, IP addresses, days, dates, times, names and places for example. Consequently, it can be expected that in practice a significant amount of the output data is not in fact of the type being sought.

Subsequently, as shown in FIG. 5, the data output by the statistical engine 10 is input to the pattern engine 20 as a sequence of characters, optionally without any tags but in any case with an indication where breaks in the text occur due to removal of text not meeting the probability threshold. This indication of breaks prevents the pattern engine from falsely linking a name to an address where, in the original text, the name and the address are spaced apart by intermediate text that has been removed by the statistical engine 10.

The pattern engine 20 then processes the sequence of characters received from the pattern engine in the normal manner and outputs the results as normal. In this case, the pattern engine 20 is the master engine to the extent that it is primarily responsible for extracting correct information. Put another way, the statistical engine 10 extracts possibly relevant regions of the text and the pattern engine 20 then scans only those regions. The advantage of the present embodiment is that the quick processing of the statistical engine can be used to filter out most of the spurious information in large bodies of text, for example of several hundred pages, before the more computationally expensive pattern engine processes the remaining data, which has a greater chance of being relevant, to provide accurate output data in a useful format.

The precise percentage threshold may be any suitable percentage to remove the majority of spurious data and is preferably in the range between 1% and 20%. More preferably, it falls within the range 3% to 10%, and most preferably is 5%.

A third aspect of the present invention is similar to the second aspect and is schematically illustrated in FIG. 6. However, in this case the probability threshold of the statistical engine 10 is set to be higher, with the aim that most of the output data from the statistical engine 10 is indeed data of the type sought by the combination engine 1. The output of the statistical engine 10 is again sent to the pattern engine 20 as a sequence of characters, optionally without any tags but in any case with an indication where breaks in the text are. Again, this indication of breaks prevents the pattern engine 20 from falsely linking a name to an address where in the original text the name and the address are spaced apart by intermediate text that has been removed by the statistical engine 10.

The pattern engine 20 then processes the sequence of characters received from the statistical engine 10 in the normal manner and outputs the results. In this case, the statistical engine 10 can be considered the master engine since it is the engine primarily responsible for deciding whether data in the sequence of characters matches the sought data. Thus, the pattern engine does not have an opportunity to process text that does not have a high probability of being the data sought after. Rather, the pattern engine 20 is used to filter out false positives that may be output by the statistical engine 10.

For example, assume that the sequence of characters input to the statistical engine 10 is an e-mail thread including lower down the thread the question “I am going to the electronics shop. Is there anything you would like me to get?” and higher up the thread the reply “1 GB Disc Drive”. The statistical engine 10 has a high probability of outputting “1 GB Disc Drive” as an address. However, the pattern engine would recognise that the expression “Disc Drive” does not form part of an address and would not extract the expression “1 GB Disc Drive” as an address. In this manner, the pattern engine 20 invalidates the result output from the statistical engine 10 by recognising elements of an address and ruling others out. The same technique can be used to prevent numbers in certain formats from being recognised as telephone numbers, for example. Other applications will also be recognised by those skilled in the art. Accordingly, in the present embodiment, the stricter grammar rules of the pattern engine 20 are used to prevent the combination engine 1 from outputting false positives identified by the statistical engine 10.

The precise percentage threshold adopted for the statistical engine 10 in this embodiment may be any suitable percentage such that the majority of output data is in practice sought data and is preferably in the range between 50% and 100%. More preferably, it falls within the range 70% to 90%, and most preferably is 80%.

In a yet further embodiment of the present invention, the combination engine is modified as shown in FIG. 7. In particular, FIG. 7 shows a combination engine 2 comprising a modified statistical engine 12 and a modified pattern engine 26 in which the lexer 22 has been removed. The character sequence is again processed first by the statistical engine 12 and the resultant output is processed directly by the parser 24 of pattern engine 26. However, in this case, the statistical engine 12 is trained to output tokens having a lexeme and a token type which can then be processed by the pattern engine 20. Thus, instead of outputting the sequence of characters “Graebel Broking Services Worldwide, 16346 E. Airport Circle, Aurora, Colo. 80011, USA” as an address, as with the statistical engine 10 in the previous embodiments, the statistical engine 12 is instead trained to output the tokens:

lexeme: Graebel Broking Services Worldwide; token type: organisation name lexeme: 16346 E. Airport Circle; token type street lexeme: Aurora; token type: town lexeme: CO; token type: state lexeme: 80011; token type: postal code lexeme: USA; token type: country

In this manner, the statistical engine acts in place of the lexer 22 of the combination engine 1. The parser 24 then parses the tokens and establishes whether the sequence of token types matches any of the predetermined patterns stored in its grammar. In this way, the combination engine will correctly output the address, including the correct organisation name, but decomposed into a more useful format than could be output by the statistical engine 10 alone.

In a still further embodiment of the present invention, the combination engine is modified as shown in FIG. 8. In particular, FIG. 8 shows a combination engine 3 comprising the modified statistical engine 12 and a modified pattern engine 28 in which the lexer 22 and the parser 24 are included. The character sequence is input simultaneously to the statistical engine 12 and the lexer 22. Similarly to above, the statistical engine 12 is trained to output tokens having a lexeme and a token type which can be processed by the parser 24 of the pattern engine 28. In addition, in the normal manner, the lexer 22 outputs tokens having lexemes and token types in accordance with the vocabulary of the lexer 22. The streams of tokens output by the statistical engine 12 and the lexer 22 are both parsed separately by the parser 24. Accordingly, the parser 24 outputs two sets of data, each purporting to be data of the type sought by the combination engine 3. The two sets of data are input to a comparison engine 3, which compares them and provides a final output of the detected data from the comparison engine 3.

It will be appreciated by persons skilled in the art that there are numerous ways in which the comparison engine 30 might operate. However, the present inventors have recognised that in general the statistical engine 10 detects names more accurately than the pattern engine 20 since it is difficult to describe names in terms of patterns. Indeed, in some approaches, pattern engines 20 consider any word starting with an upper case to be a name. This is a “fuzzy” means of recognising a name and can easily give incorrect outputs.

Accordingly, it is preferred that if an item of data detected based on the tokens produced by the statistical engine 12 is the same as an item of data detected based on the tokens produced by the lexer 22, the comparison engine 30 detects this and outputs the data as a single item with the appropriate tag. If an item of data detected based on the tokens produced by the statistical engine 12 is different to an item of data detected based on the corresponding tokens produced by the lexer 22 (in other words tokens resulting from the same characters of the initially input sequence of characters), the comparison engine 30 will determine which item to output based on the tag assigned to the items. For example, if both items are assigned with an address tag, the comparison engine will output only the item of data detected based on the tokens produced by the lexer 22. By contrast, if both items are assigned with a name tag, the comparison engine will output only the item of data detected based the tokens produced by the statistical engine 12. If the stream of tokens from one of the statistical engine 12 and the lexer 22 results in an item that is not output based on the stream of tokens from the other of the statistical engine 12 and the lexer 22, the comparison engine 30 outputs the item anyway, unless the item is a name based on the stream of tokens from the lexer 22.

In this manner, the statistical engine 12 acts in tandem with the lexer 22 of the combination engine 3. The parser 24 then parses the tokens from both and establishes whether either sequence of token types matches any of the predetermined patterns stored in its grammar. In this way, the combination engine will correctly output the address, including the correct organisation name, but decomposed into a more useful format than could be output by the statistical engine 10 alone.

A modification of this embodiment is shown in FIG. 9. In the combination engine 4 of FIG. 9, a comparison engine 32 is provided with inputs from the statistical engine 12 and the lexer 22 and provides an output to the parser 24. As in the previous embodiment, the statistical engine 12 and the lexer 22 both output sequences of tokens, each having a lexeme and a token type. The token types that can be output by the statistical engine 12 are the same as those that can be output by the lexer 22. The comparison engine 32 compares the tokens output by the statistical engine 12 and the lexer 22 and decides which tokens to output to the parser 24. In the event that a token from the statistical engine 12 is the same as a corresponding token provided by the lexer 22, the comparison engine outputs only one of said tokens to the parser 24. However, the comparison engine 32 is also provided with a series of rules in the event that corresponding tokens are different, having a different lexeme and/or a different token type. Such rules will ensure that only one of the tokens is output or that both tokens are output to the parser 24 as required.

In a further refinement, certain tokens can be assigned more or less weight depending on which engine they come from. The comparison token would choose only the token with the highest weight. For example, a ‘name’ token would have a low weighting if it originates from the lexer 22 and high weight if it originates from the statistical engine 10.

In a preferred embodiment, a combination engine 5 comprises a statistical engine 110 and a pattern engine 120, as shown in FIG. 10. The statistical engine 110 is trained to detect types of data that are difficult to accurately detect by a pattern engine and to output such data as tokens having lexemes and token types. The grammar of the parser 124 is adjusted to be able to process the tokens output by the statistical engine 110 in addition to the tokens output by the lexer 22 in the usual manner.

In this embodiment, the statistical engine 110 operates on the sequence of characters first. Where it detects data of the type it is trained to detect, the statistical engine 110 will output that data as a token. However, it will leave the remaining data unchanged. Accordingly, the lexer 122 receives as an input from the statistical engine 110 the original sequence of characters, but with portions of it having been converted to tokens. The lexer 122 processes the sequence of characters with the interspersed tokens. The sequence of characters is processed in the usual manner, but the tokens inserted by the statistical engine 110 are unaffected. Accordingly, the parser 124 receives as its input a sequence of tokens from the lexer 122, including tokens created by both the statistical engine 110 and the lexer 122 and processes the sequence in the usual manner.

For example, the statistical engine 120 may be trained to detect person and organisation names only and to output corresponding PersonName and OrgName type tokens. By contrast, the lexer 122 may be programmed to output Street, Town, State, Postal_Code, Country and Telephone_Number type tokens but not name type tokens. The grammar of the parser 124 may have its grammar adjusted to detect an address as:

-   Address: =PersonName? OrgName? Street Town State? Postal_Code?     Country?     Imagine the statistical engine 120 receives as its input the     sequence of characters: -   “Jon, I am considering buying 300 shares in Acme Inc. Before you     make the purchase, please contact Wilson Nagai, Graebel Broking     Services Worldwide, 16346 E. Airport Circle, Aurora, Colo. 80011,     USA, Tel 801 234 7771”     It might output: -   (TOKEN: LEX Jon; TYPE PersonName), I am considering buying 300     shares in (TOKEN: LEX Acme Inc; TYPE OrgName). Before you make the     purchase, please contact (TOKEN: LEX Wilson Nagai; TYPE PersonName),     (TOKEN: LEX Graebel Broking Services Worldwide; TYPE OrgName),     16346 E. Airport Circle, Aurora, Colo. 80011, USA, Tel 801 234 7771     This sequence is in turn input to the lexer 122 of the pattern     engine 120, which might output to the parser 124 the sequence of     tokens: -   LEX Jon; TYPE PersonName -   LEX I am considering buying; TYPE Miscellaneous -   LEX 300; TYPE Number -   LEX shares in; TYPE Miscellaneous -   LEX Acme Inc; TYPE OrgName -   LEX Before you make the purchase, please contact; TYPE Miscellaneous -   LEX Wilson Nagai; TYPE PersonName -   LEX Graebel Broking Services Worldwide; TYPE OrgName -   LEX 16346 E. Airport Circle TYPE Street -   LEX Aurora; TYPE Town -   LEX CO; TYPE State -   LEX 80011; TYPE Postal-Code -   LEX USA; TYPE Country -   LEX 801 234 7771; TYPE Phone_no     Given the grammar Address: =PersonName? JobTitle? OrgName? Street     Town State? Postal_Code? Country?, the parser 124 will parse this     series of tokens to output the address: -   Wilson Nagai -   Graebel Broking Services Worldwide -   16346 E. Airport Circle -   Aurora -   CO -   80011 -   USA     with each line being decomposed with the appropriate tag. In this     way, the advantages of the statistical engine with certain types of     data are exploited and the advantages of the pattern engine with     other types of data are also exploited.

It has generally been found that statistical engines are significantly better at detecting addresses in foreign languages, in particular far eastern languages such as Chinese and Japanese. This is because such addresses commonly do not have the same structure as western addresses, or even a common format pattern at all. Thus, it is difficult to establish a grammar that will consistently detect such addresses.

Accordingly, when it is intended to detect addresses in texts in far eastern languages, it is preferred to use a statistical engine trained using a corpus in the appropriate language and trained to output a token having the whole address as the lexeme with the token type Address. In this case, the grammar of the pattern engine 120 is adapted to recognise address tokens output by the statistical engine 110. For example, the parser 124 may have the grammar:

-   Contact: =PersonName JobTitle? OrgName? Address? E-mail? Phone_no?     Fax_no?

In this case, the statistical engine 110 may be trained to output names, job titles and addresses, and the lexer 122 may be programmed to output e-mail addresses, and telephone and fax numbers. In the case of text input in a far eastern language, the combination engine will be able to detect full contact details, including the physical and e-mail addresses and the contact numbers, with significantly better accuracy than would be possible with either a statistical engine or a pattern engine separately.

In this embodiment, in which the statistical engine and the pattern engine are respectively trained and programmed to detect different types of data and output correspondingly different tokens for parsing, it has so far been assumed that the tokens output from the statistical engine and the lexer are adjacent in order for them to be linked in the grammar of the parser. As an example, assume that a pattern detection engine is programmed to recognise, as a name in front of an address, the pattern

-   name: =Capitalized_word Capitalized_word; -   address: =name? number street_name zipcode etc. . . .     In this case, if the pattern engine is fed the sequence of     characters: -   Matt Mahon and Sarah Garcia -   1701 Piedmont -   Irvine, Calif. 92620     it would output the contact: -   Sarah Garcia -   1701 Piedmont -   Irvine, Calif. 92620     In this case, only the name Sarah Garcia is associated with the     address, and the name Matt Mahon has been erroneously omitted. When     the pattern engine is used alone, this error arises from the     vocabulary and grammar of the pattern detection method.

However, it is also possible to program the grammar of the pattern engine to associate more than one name with an address, for example by modifying the grammar to

-   name: =Capitalized_word Capitalized_word; -   address: =name? (“and” name)? number street_name zipcode etc. . . .

In the above example, Matt Mahon and Sarah Garcia would both be correctly associated with the address. However, such a grammar could also trigger a large number of false positives. For example, the pattern engine would output the sequence of characters “BTW Address and Phone Number 12, place d'lena 75016 Paris” two people (eg Mr BTW Address and Ms Phone Number) associated with the address.

However, in the currently described modification, the parser 124 could maintain the grammar

-   name: =Capitalized_word Capitalized_word; -   address: =name? (“and” name)? number street_name zipcode etc. . . .

In the Matt Mahon and Sarah Garcia example, the lexer 122 receives from the statistical engine 110 the series of characters and tokens:

-   (TOKEN <LEX Matt Mahon; TOKEN TYPE PersonName>) and (TOKEN <LEX     Sarah Garcia; TOKEN TYPE PersonName>) 1701 Piedmont Irvine, Calif.     92620     and outputs the series of tokens: -   StatLEX Matt Mahon; TYPE PersonName -   LEX and; TYPE Miscellaneous -   StatLEX Sarah Garcia; TYPE PersonName -   LEX 16346 1701 Piedmont; TYPE Street -   LEX Irvine; TYPE Town -   LEX CA; TYPE State -   LEX 92620; TYPE Postal-Code

Note that a distinction is made between tokens output by the statistical engine (StatLEX tokens or statistical engine tokens) and tokens output by the lexer (LEX tokens or lexer tokens), although this is not required in all embodiments. Here the parser 124 detects the names, street, town, state and postal code lexer tokens as a “name(s) before an address” pattern.

In the “BTW Address and Phone Number: 12, place d'lena 75016 Paris” example, the statistical engine 110 does not output “BTW Address” or “Phone Number” as name tokens and the error that would arise from using the pattern detection engine 120 alone is avoided.

In an alternative arrangement, the parser 124 checks the distance between the first token in an address and any preceding statistical engine name token. If there are one or more such statistical engine name tokens spaced apart a predetermined distance or less from the address, the grammar of the parser 124 associates the statistical engine name tokens with the address detected on the basis of the lexer tokens. In the present example, the distance threshold would be set as two lexer tokens or less. The statistical engine name token “Sarah Garcia” is not spaced apart from the lexer tokens making up the address and is therefore associated with the address. In addition, the statistical engine token “Matt Mahon” is spaced apart from the lexer tokens making up the physical address by the single lexer token “and”. As this number (1) falls below the threshold, the name “Matt Mahon” is also associated with the address.

It is should be noted that this is a simple example of the general concept of this embodiment. As another example, it would also be possible to associate Chinese or other far eastern-language addresses detected by the statistical engine with phone numbers adjacent to or spaced a short distance apart from an address.

FIG. 11 illustrates an exemplary embodiment of a computer system 1800 in which a combination engine of the present invention may be realised. Computer system 1800 may form part of a desktop computer, a laptop computer, a mobile phone, a PDA or any other device that processes text. It may be used as a client system, a server computer system, or as a web server system, or may perform many of the functions of an Internet service provider.

The computer system 1800 may interface to external systems through a modem or network interface 1801 such as an analog modem, ISDN modem, cable modem, token ring interface, or satellite transmission interface. As shown in FIG. 11 the computer system 1800 includes a processing unit 1806, which may be a conventional microprocessor, such as an Intel Pentium microprocessor, an Intel Core Duo microprocessor, or a Motorola Power PC microprocessor, which are known to one of ordinary skill in the computer art. System memory 1805 is coupled to the processing unit 1806 by a system bus 1804. System memory 1805 may be a DRAM, RAM, static RAM (SRAM) or any combination thereof. Bus 1804 couples processing unit 1806 to system memory 1805, to non-volatile storage 1808, to graphics subsystem 1803 and to input/output (I/O) controller 1807. Graphics subsystem 1803 controls a display device 1802, for example a cathode ray tube (CRT) or liquid crystal display, which may be part of the graphics subsystem 1803. The I/O devices may include one or more of a keyboard, disk drives, printers, a mouse, a touch screen and the like as known to one of ordinary skill in the computer art. A digital image input device 1810 may be a scanner or a digital camera, which is coupled to I/O controller 1807. The non-volatile storage 1808 may be a magnetic hard disk, an optical disk or another form for storage for large amounts of data. Some of this data is often written by a direct memory access process into the system memory 1806 during execution of the software in the computer system 1800.

In a preferred embodiment, the non-volatile storage 1808 stores a library of different statistical engines, which are trained using corpuses in different languages, and one or more pattern engines so that at least one pattern engine is suitable for use with each statistical engine. The computer system receives a sequence of characters in the form of an e-mail or other text over the modem or network interface 1801, or via the I/O controller 1807, for example from a disk inserted by the user or a document scanned by the scanner. The processor detects the language of the text and constructs the combination engine by retrieving the appropriate statistical engine and a corresponding pattern engine from the non-volatile storage 1808 and storing them in the computer memory 1805. Subsequently the processing unit 1806 uses the combination engine to scan the text and displays the output using the graphics subsystem 1803 and the display 1802. Preferably, the detected data is identified in the original text by highlighting it, displaying it in a different colour and/or font, or ringing it. The user may also be given an option to use the data, for example by storing it in an address book, using an e-mail address in a new e-mail, telephoning an identified phone number and so on.

The foregoing description has been given by way of example only and it will be appreciated by those skilled in the art that modifications may be made without departing from the broader spirit or scope of the invention as set forth in the claims. The specification and drawings are therefore to be regarded in an illustrative sense rather than a restrictive sense. 

What is claimed is:
 1. A machine-implemented method of detecting data of a plurality of types in a sequence of characters, the method comprising: combining the use of a pattern detection method and a statistical learning method to detect the data, the statistical learning method converting the sequence of characters into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the sequence of characters and having at least a predetermined probability that the corresponding data is of at least one of said types, the pattern detection method converting the sequence of characters into a second sequence of tokens, each token corresponding to data that matches a predetermined pattern indicative of the at least one of said types, the pattern detection method further parsing a combination of the first and second sequence of tokens; comparing the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the sequence of characters are the same, parsing only one of the corresponding tokens, when the tokens are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical learning method; and outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern.
 2. The method of claim 1, wherein the at least one of said types is an address and the subset of types comprises at least one of a street, a town, a county, a state, a country and a postal code.
 3. The method of claim 1, wherein each token in the first sequence of tokens further comprises a probability that the corresponding data is data of one of said types; and parsing only tokens having at least a predetermined probability using the pattern detection method.
 4. The method of claim 1, wherein each token in the first sequence of tokens corresponds to data having at least a predetermined probability that the data is data of one of said types.
 5. The method of claim 3 or claim 4, wherein the predetermined probability is 5%.
 6. The method of claim 3 or claim 4, wherein the predetermined probability is low and the pattern detection method extracts the data from a correspondingly large number of the tokens in the first sequence of tokens.
 7. The method of claim 3 or claim 4, wherein the predetermined probability is 80%.
 8. The method of claim 3 or claim 4, wherein the predetermined probability is high and the pattern detection method removes tokens in the first sequence of tokens matching a predetermined pattern to extract the data.
 9. The method of claim 3 or claim 4, wherein the pattern detection method outputs tokens corresponding to data that matched a predetermined pattern, each token having a token type indicating the type of data.
 10. The method of claim 1, wherein the statistical learning method outputs tokens of a first token type and the pattern detection method outputs tokens of a second token type, and at least one of said plurality of types of data comprises at least a token of the first token type and a token of the second token type.
 11. A machine-implemented method of processing data comprising: receiving text; processing the text using both a pattern engine and a statistical engine to detect data of a plurality of predetermined types, the statistical engine converting the text into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the text and having at least a predetermined probability that the corresponding data is of at least one of the predetermined types, the pattern engine converting the text into a second sequence of tokens, each token corresponding to data that matches a predetermined pattern indicative of the at least one of the predetermined types, the pattern engine further parsing a combination of the first and second sequence of tokens; and comparing the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the text are the same, parsing only one of the corresponding tokens, when the tokens are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical engine; and outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern.
 12. The method of claim 11, wherein the at least one of the predetermined types is an address and the subset of types comprises at least one of a street, a town, a county, a state, a country and a postal code.
 13. The method of claim 11, wherein each token in the first sequence of tokens further comprises a probability of the corresponding data being data of a said predetermined type; parsing only tokens that have at least a predetermined probability using the pattern engine.
 14. The method of claim 11, wherein the statistical engine outputs tokens of a first token type and the pattern engine outputs tokens of a second token type, and at least one said predetermined types of data includes at least a token of the first token type and a token of the second token type.
 15. An article of manufacture comprising: a non-transitory computer readable storage medium including instructions that, when accessed by a machine, causes the machine to detect data of a plurality of types in an input sequence of characters by performing operations comprising: combining the use of a pattern detection method and a statistical learning method to detect the data, the statistical learning method converting the sequence of characters into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the sequence of characters and having at least a predetermined probability that the corresponding data is of at least one of the types, the pattern detection method converting the sequence of characters into a second sequence of tokens, each token corresponding to data that matches a predetermined pattern indicative of the at least one of the types, the pattern detection method further parsing a combination of the first and second sequence of tokens; and comparing the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the sequence of characters are the same, parsing only one of the corresponding tokens, when the tokens are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical learning method; and outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern.
 16. An article of manufacture according to claim 15, wherein the article of manufacture stores a client application program that is being executed on a processor.
 17. An article of manufacture comprising: a non-transitory computer readable storage including data that, when accessed by a machine, causes the machine to perform operations comprising: receiving text; processing the text using both a pattern engine and a statistical engine to detect data of a plurality of predetermined types, the statistical engine converting the text into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the text and having at least a predetermined probability that the corresponding data is of at least one of the predetermined types, the pattern engine converting the text into a second sequence of tokens, each token corresponding to data that matches a predetermined pattern indicative of the at least one of the predetermined types, the pattern engine further parsing a combination of the first and second sequence of tokens; and comparing the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the text are the same, parsing only one of the corresponding tokens, when the tokens are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical engine; and outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern.
 18. An article of manufacture according to claim 17, wherein the article of manufacture stores a client application program that is being executed on a processor.
 19. An article of manufacture according to claim 17, wherein each token in the first sequence of tokens further comprises a probability that the corresponding data is data of one of said predetermined types and wherein the non-transitory computer readable storage medium further includes data that, when accessed by a machine, causes the machine to perform operations comprising: parsing only tokens corresponding to data which has at least a predetermined probability of being data of a said predetermined type using the pattern engine.
 20. An article of manufacture according to claim 17, wherein the non-transitory computer readable storage medium further includes data that, when accessed by a machine, causes the machine to perform operations comprising: using the statistical engine to output tokens having a first token type and the pattern engine to output tokens having a second token type, wherein at least one of said plurality of types of data comprises at least a token of the first token type and a token of the second token type.
 21. A data processing system, the system comprising: an input for receiving text, the input coupled to a processor through a bus; a pattern engine executing on the processor; a statistical engine executing on the processor, wherein the pattern engine and the statistical engine together detect data of a plurality of predetermined types in the text, the statistical engine converting the text into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the text and having a predetermined probability that the corresponding data is of at least one of the predetermined types, the pattern engine converting the text into a second sequence of tokens, each token corresponding to data that matchers a predetermined pattern indicative of the at least one of the predetermined types, the pattern engine further parsing a combination of the first and second sequence of tokens; and a comparison engine executing on the processor to compare the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the text are the same, parsing only one of the corresponding tokens, when the token are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical engine; and an output for outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern, the output coupled to a processor through the bus.
 22. The system according to claim 21, wherein the at least one of said predetermined types is an address and the subset of types comprises at least one of a street, a town, a county, a state, a country and a postal code.
 23. The system according to claim 21, wherein each token in the first sequence of tokens further comprises a probability that the corresponding data is data of one of said predetermined types and the pattern engine parses only tokens corresponding to data which has at least a predetermined probability of being data of a said predetermined type.
 24. The system according to claim 21, wherein: the statistical engine outputs tokens of a first token type and the pattern engine comprises a lexer, which outputs tokens of a second token type; wherein at least one of said predetermined types of data comprises at least a token of the first token type and a token of the second token type.
 25. A data detecting system for detecting data of a plurality of types in text, the system comprising: a pattern detection means; a statistical engine means, wherein the pattern detection means and the statistical learning means are operative together to detect the data, the statistical engine means converting the text into a first sequence of tokens, each token comprising a lexeme and a token type relating to the function of the lexeme within the text and having at least a predetermined probability that the corresponding data is of at least one of said types, the pattern detection means converting the text into a second sequence of tokens, each token corresponding to data that matches a predetermined pattern indicative of the at least one of said types, the pattern detection means further parsing a combination of the first and second sequence of tokens; and a comparison means to compare the first and second sequence of tokens, wherein when corresponding tokens from the first and second sequence of tokens for a portion of the text are the same, parsing only one of the corresponding tokens, when the tokens are not name tokens and the corresponding tokens are different, parsing both corresponding tokens, and when the tokens are name tokens and the corresponding tokens are different, parsing the corresponding token only from the statistical engine means; and means for outputting the data corresponding to the combination of tokens as the data that matches the predetermined pattern.
 26. The system of claim 25, wherein the at least one of the predetermined types is an address and the subset of types comprises at least one of a street, a town, a county, a state, a country and a postal code.
 27. The system of claim 25, wherein the statistical engine means outputs tokens in combination with a probability that the corresponding data is data of one of said types; the pattern detection means parses only tokens having at least a predetermined probability.
 28. The system of claim 25, wherein the statistical learning means outputs tokens corresponding to data having at least a predetermined probability of being data of one of said types.
 29. The system of claim 25, wherein the statistical engine means outputs tokens of a first token type, the pattern detection means outputs tokens of a second type and at least one of said predetermined types of data comprises at least a token of the first token type and a token of the second token type. 